<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function add() {
            console.log(arguments);
            let arr = Array.prototype.slice.call(arguments, 1, 3)
            console.log(arr);
            let sum = 0;
            arr.forEach(function (item) {
                sum += item;
            });
            console.log(sum);
            return sum;
        }

        add(1, 2, 3, 4, 5)



        let Cat = {
            eat: 'fish'
        }

        function Dog() {
            this.eat = 'bone';
            console.log(this);
        }
        Dog.prototype.say = function () {
            console.log(this.eat);
        }
        let dog = new Dog();
        dog.say(); //bone

        Dog.prototype.say.call(Cat); //fish
        dog.say.call(Cat); //fish

        let dog_bind = dog.say.bind(Cat);
        dog_bind();
    </script>
</body>

</html>